<?php

/**

 * 商品服务层

 * @author maniac

 */

namespace app\common\service;

use app\common\model\Point AS PointModel;

class Point extends Base

{

	/**
	
	* 获取积分商城商品列表
	
	* @param array  $where 查询条件
	
	* @param string $field 查询的字段
	
	* @param string $limit 分页条件
	
	* @param string $order 排序条件
	
	*/
	
	public function point($where, $limit = '', $field = '', $order = '')
	
	{
	
		 $field = $field ?: 'id,point,goods_name,category_id,goods_sn,goods_unit,market_price,sale_price,goods_stock,goods_thumb_id,goods_album,goods_video,goods_keywords,goods_intro,goods_spec_format,goods_detail,collect_nums,comment_stars,evaluate_nums,is_sale,max_purchase_nums,min_purchase_nums,sale_time,actual_sale_nums';


        return PointModel::field($field)->append(['market_price', 'sale_price', 'goods_spec_format_array', 'image_uri', 'goods_album_detail', 'is_sale_txt', 'sale_time_txt', 'sku', 'total_sale_nums', 'attr_value', 'goods_video_uri'])->where($where)->order($order)->limit($limit)->select()->toArray();
	
	
	}
	/**
	
	* 获取商品详情
	* * @param array  $where 查询条件
	
	*/
	public function detail($append='',$field='',$where)
	
	{
		$field = $field ?: 'id,point,goods_name,category_id,goods_sn,goods_unit,market_price,sale_price,goods_stock,goods_thumb_id,goods_album,goods_video,goods_keywords,goods_intro,goods_spec_format,goods_detail,collect_nums,comment_stars,evaluate_nums,is_sale,max_purchase_nums,min_purchase_nums,sale_time,actual_sale_nums';
	
		$append = $append ?: [ 'goods_spec_format_array', 'image_uri', 'goods_album_detail', 'is_sale_txt', 'sale_time_txt', 'sku', 'total_sale_nums', 'attr_value', 'goods_video_uri'];
	
		return PointModel::field($field)
		 
		->append($append)
		 
		->where($where)
		 
		->find();
	
	
	}
    
}

